package com.cet.spring_batch_study.client;

import org.springframework.boot.context.properties.PropertyMapper;

/**
 * @author NSOC
 */
public class PropertyMapperTest {

    public static void main(String[] args) {
        PropertyMapper propertyMapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
        Soldier soldier = new Soldier();
        soldier.setName("小飞");
        soldier.setRank("下士");
        soldier.setAge(22);

        Student student = new Student();
        propertyMapper.from(soldier::getName).to(student::setName);
        propertyMapper.from(soldier::getRank).to(student::setGrade);
        propertyMapper.from(soldier::getAge).to(student::setAge);
        System.out.println(student);
    }
}
